home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-03-19 | 2.5 KB | 80 lines | [TEXT/CWIE] |
- //
- // CBevelAttachment.h
- //
- // A Constructor-aware, PowerPlant Attachment for adding
- // an Apple Grayscale Appearance-like bevel to an LView.
- //
- // Copyright ©1996 by James Jennings. All rights reserved.
- // September 1, 1996
- //
-
- #pragma once
-
- #include "UGrayscaleAppearance.h"
-
- // A base class for all Grayscale Appearance attachments.
- // ExecuteSelf() determines the kind of device, and calls one of the Draw... methods.
- // Sub-classes override the draw methods.
- class CGABaseAttachment : public LAttachment, public UGrayscaleAppearance {
- protected:
- CGABaseAttachment() : LAttachment( msg_DrawOrPrint ) {}
- CGABaseAttachment( LStream */*inStream*/ );
- public:
- virtual void ExecuteSelf(
- MessageT inMessage,
- void *ioParam);
- virtual void DrawColor( Rect /*inFrame*/ ) {}
- virtual void DrawBlackAndWhite( Rect /*inFrame*/ ) {}
- protected:
- virtual void AdjustClipRect( Rect &/*inRect*/ ) {}
- };
-
- // A Grayscale Appearance attachment that can be Reanimated.
- class CBevelAttachment : public CGABaseAttachment {
- public:
- enum { class_ID = 'Bevl' };
- static CBevelAttachment* CreateFromStream(LStream *inStream);
- static void Register(void)
- { URegistrar::RegisterClass(class_ID, (ClassCreatorFunc) CreateFromStream); }
-
- CBevelAttachment(LStream *inStream);
- CBevelAttachment( Boolean inBevelIn, Int16 inWidth = 1, Boolean inErase = false );
-
- virtual void DrawColor( Rect inFrame );
- protected:
- virtual void AdjustClipRect( Rect &inRect )
- { if (mWidth<0) ::InsetRect( &inRect, mWidth, mWidth ); }
-
- Boolean mBevelIn; // bevel goes in or out?
- Int16 mWidth; // width of the bevel (usually 1)
- Boolean mErase; // erase the center to white?
- };
-
- /*
- * Some really simple attachments. Can be replaced with a CBevelAttachment.
- * (Included for backward compatibility.)
- */
-
- // An attachment that adds a Grayscale Appearance to a basic pane.
- // (Background fill, convex bevel)
- class CGAPaneAttachment : public CGABaseAttachment {
- public:
- virtual void DrawColor( Rect inFrame );
- };
-
- // An attachment that adds the Grayscale Appearance of a movable modal dialog box.
- // (Background fill, 2 pixel convex bevel, no black outline)
- class CGADeepPaneAttachment : public CGABaseAttachment {
- public:
- virtual void DrawColor( Rect inFrame );
- };
-
- // An attachment that adds a Grayscale Appearance to things like LEditField.
- // (No fill, concave bevel)
- class CGATextFieldAttachment : public CGABaseAttachment {
- public:
- virtual void DrawColor( Rect inFrame );
- protected:
- virtual void AdjustClipRect( Rect &inRect ) { ::InsetRect( &inRect, -1, -1 ); }
- };
-